<?php $post = $this->getPost();?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="case_tudy02 page">
<?php if($post->getNfile()){?>
<div class="news_img02">
<img src="<?php echo Mage::getModel('imageresize/imagemodel')->init(Mage::getBaseUrl('media').$post->getNfile())->resize(223)?>" alt="<?php echo $post->getNfileAlt()?>" />
</div>
<?php }?>
<h2 class="title01"><span><img src="<?php echo $this->getSkinUrl()?>images/image_01.gif" alt="" width="19" height="19" /></span>Client: <?php echo $post->getTitle()?></h2>
<?php echo $post->getPostContent(); ?>

<div class="turnkey_images">
<h2 class="title01"><span><img src="<?php echo $this->getSkinUrl()?>images/image_01.gif" alt="" width="19" height="19" /></span>Project Images</h2>
<ul>
<?php 
$tImage=$post->getImagegallery();
$imageCount=0;

if($tImage && is_array(json_decode($tImage,true))){
	$tImage=json_decode($tImage,true);
	$outputstring=array();
	
	foreach ($tImage as $image){
		$imageCount++;
		if($imageCount>4){
			break;
		}
		$url = @$image['filepath'];
		$desc = @$image['filename'];
		$pos = @$image['filepos'];
		//$linkurl = @$image['linkurl'];
		
		$imagestring='<li><a href="'.Mage::getModel('imageresize/imagemodel')->init(Mage::getBaseUrl('media').$url)->resize().'" rel="shadowbox" title="'.$desc.'"><img src="'.Mage::getModel('imageresize/imagemodel')->init(Mage::getBaseUrl('media').$url)->resize(145,114).'" alt="'.$desc.'" /></a></li>';
		if($pos!=""){
			if(!isset($outputstring[$pos])){
				$outputstring[$pos]=$imagestring;
			}else{
				$outputstring[$pos].=$imagestring;
			}
		}else{
			$outputstring[]=$imagestring;
		}
		
	}
	echo implode("\n",$outputstring);
}

for ($i=4-$imageCount;$i>0;$i--){
	echo '<li></li>';
}

?>
</ul>
<div class="hack"></div>
</div>
<h2 class="title01"><span><img src="<?php echo $this->getSkinUrl()?>images/image_01.gif" alt="" width="19" height="19" /></span>Project Downloads</h2>
<div>
<?php 
$tFile=$post->getFilegallery();
$fileCount=0;
unset($outputstring);

if($tFile && is_array(json_decode($tFile,true))){
	$tFile=json_decode($tFile,true);
	$outputstring=array();
	
	foreach ($tFile as $file){
		$fileCount++;

		$url = @$file['filepath'];
		$desc = @$file['filename'];
		$pos = @$file['filepos'];
		//$linkurl = @$image['linkurl'];
		if(!$desc){
			$desc=basename($url);
		}
		
		$filestring='<p>'.$desc.' <a href="'.Mage::getBaseUrl('media').$url.'" target="_blank"><strong class="tt">Click Here</strong></a></p>';
		if($pos!=""){
			if(!isset($outputstring[$pos])){
				$outputstring[$pos]=$filestring;
			}else{
				$outputstring[$pos].=$filestring;
			}
		}else{
			$outputstring[]=$filestring;
		}
	}
	echo implode("\n",$outputstring);
}

?>

</div>
<h2 class="title01"><span><img src="<?php echo $this->getSkinUrl()?>images/image_01.gif" alt="" width="19" height="19" /></span>Share this page with someone</h2>
<div class="container">
<div class="fillet_top"></div>
<div class="cont ht">

<form id="shareForm" action="<?php echo $this->getUrl()?>contactus/index/shareToFriend" method="post">
<table width="0%" border="0" cellspacing="0" cellpadding="0" class="form01">
  <tr>
    <th >Your Name:	</th>
        <th  style="width:3px"></th>
    <th >Your Email Address:</th>
 <td rowspan="5" align="left" valign="top">
 <div class="form_news">
<h3>Information:</h3>
<p >When you fill in the form on the left, we will use<br /> the information submitted to send an email to your<br />  friend, in that email we will include a link to this<br />  page and a bit about our company.</p>
<p>To Opt out of future correspondence from us please tick here</p>
</div>
 </td>
        </tr>
  <tr>
    <td>
        <label>
          <input type="text" name="name" id="name" class="required-entry txtinput"/>
        </label>
</td>
<td></td>
    <td>  <label>
      <input type="text" name="email" id="email" class="required-entry validate-email txtinput"/>
    </label></td>
     </tr>
    <tr>
    <th>Friends Name:</th>
        <th style="width:3px"></th>
    <th>  Friends Email:</th>
 </tr>
  <tr>
    <td>
        <label>
          <input type="text" name="fname" id="fname" class="required-entry txtinput"/>
        </label>
</td>
<td></td>
    <td>  <label>
      <input type="text" name="femail" id="femail" class="required-entry validate-email txtinput"/>
    </label></td>
     </tr>
    <tr>
    <td colspan="3">
    <div class="su">
        <label>
          <input type="image" name="submit" id="submit" src="<?php echo $this->getSkinUrl()?>images/image_04.gif" class="bton" />
        </label>
        </div>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
       var shareForm = new VarienForm('shareForm', false);
</script>

</div>
<div class="fillet_bottom"></div>
</div>
</div>